/*
  flamingo - 2D Game Engine
  Copyright (C) 2009 Bradley Zeis

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

  Bradley Zeis
  bradzeis@gmail.com
*/

#define DISPLAY 1

#include "flamingo.h"
#include "backends/display/sdl.h"

/* -------- UTILITY -------- */
/* -------- MODULE METHODS -------- */
/* -------- DISPLAY METHODS -------- */
/* Initialization */
void Display_dealloc(Display *self) {

}

PyObject *Display_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
    Display *self;
    self = (Display *)type->tp_alloc(type, 0);

     if (self != NULL) {

    }

    return (PyObject *)self;
}

int Display_init(Display *self, PyObject *args, PyObject *kwds) {
    return 0;
}

PyObject *Display_hash(Display *self) {
    return PyInt_FromLong(PyObject_Hash(PyInt_FromLong((int)self)));
}

/* Presentation */
PyObject *Display_repr(Display *self) {
    char string[64];
    sprintf(string, "<display.sdl.Display(%i)>", (int)self);
    return PyString_FromString(string);
}

PyObject *Display_str(Display *self) {
    return Display_repr(self);
}

/* General Functions */
/* Properties */
/* Method Declaration */
PyMemberDef Display_members[] = {
    {NULL}
};

PyMethodDef Display_methods[] = {
    {NULL}
};

PyGetSetDef Display_getsets[] = {
    {NULL}
};

/* -------- TYPE DECLARATIONS -------- */
PyTypeObject Display_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                          /* ob_size */
    "flamingo.display.sdl",                     /* tp_name */
    sizeof(Display),                            /* tp_basicsize */
    0,                                          /* tp_itemsize */
    (destructor)Display_dealloc,                /* tp_dealloc */
    0,                                          /* tp_print */
    0,                                          /* tp_getattr */
    0,                                          /* tp_setattr */
    0,                                          /* tp_compare */
    (reprfunc)Display_repr,                     /* tp_repr */
    0,                                          /* tp_as_number */
    &Display_SequenceMethods,                   /* tp_as_sequence */
    0,                                          /* tp_as_mapping */
    0,                                          /* tp_hash */
    0,                                          /* tp_call */
    (reprfunc)Display_str,                      /* tp_str */
    0,                                          /* tp_getattro */
    0,                                          /* tp_setattro */
    0,                                          /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES,   /* tp_flags */
    0,                                          /* tp_doc */
    0,                                      /* tp_traverse */
    0,                                      /* tp_clear */
    0,                                      /* tp_richcompare */
    0,                                      /* tp_weaklistoffset */
    0,                                      /* tp_iter */
    0,                                      /* tp_iternext */
    Display_methods,                            /* tp_methods */
    Display_members,                            /* tp_members */
    Display_getsets,                            /* tp_getset */
    0,                                          /* tp_base */
    0,                                          /* tp_dict */
    0,                                          /* tp_descr_get */
    0,                                          /* tp_descr_set */
    0,                                          /* tp_dictoffset */
    (initproc)Display_init,                     /* tp_init */
    0,                                          /* tp_alloc */
    Display_new,                                /* tp_new */
};

/* -------- MODULE INIT -------- */
PyMODINIT_FUNC
initDisplay(void)
{
    PyObject *m;

    /* Initialize module */
    if (PyType_Ready(&Display_Type) < 0)
        return;

    m = Py_InitModule("Display", NULL);
    if (m == NULL)
        return;

    Py_INCREF(&Display_Type);
    PyModule_AddObject(m, "Display", (PyObject *)&Display_Type);
}
